<?php
/**
 * | ---------------------------------------------------------------------------------------------------
 * | Author：johnxu <fsyzxz@163.com>.
 * | ---------------------------------------------------------------------------------------------------
 * | Home: https://www.johnxu.net.
 * | ---------------------------------------------------------------------------------------------------
 * | Data: 2019-03-18
 * | ---------------------------------------------------------------------------------------------------
 * | Desc:
 * | ---------------------------------------------------------------------------------------------------
 */

namespace app\service\websocket\handler\drivers;

use app\service\websocket\handler\Driver;

class Error extends Driver
{
    protected function getType()
    {
        return 'error';
    }

    protected function intercept( \swoole_websocket_server $server, $fd )
    {
        $server->push( $fd, $this->jsonEncode( [ 'type' => $this->getType(), 'message' => '系统错误' ] ) );

        return false;
    }
}